﻿@{
    ViewBag.Title = "ViewAllAlbum";
    Layout = "~/Views/Shared/_LayoutAdmin.cshtml";
    List<ListenMusic.AdminAlbum_ServiceReference.AlbumSinger> lst = ViewBag.lstAlbum;
}
<script type="text/javascript">
    function fastGo() {
        var page = document.getElementById('fastgo');
        if (page.value > '@ViewBag.totalAlbum') {
            alert('Trang đi đến không thể lớn hơn tổng số trang');
            page.focus();
            return false;
            
        }
        else if(page.value <= 0)
        {
            alert('Trang đi đến không thể nhỏ hơn hoặc bằng 0');
            page.focus();
            return false;
            
        }
        else {
            location = '/managealbum/viewallalbum?pageindex=' + page;
        }
    }
</script>

<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="../../Images/AdminImages/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="../../Images/AdminImages/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td>
		<!--  start content-table-inner ...................................................................... START -->
		<div id="content-table-inner">
		
			<!--  start table-content  -->
			<div id="table-content">
			
				<!--  start message-yellow -->
			@*	<div id="message-yellow">
				<table border="0" width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td class="yellow-left">You have a new message. <a href="">Go to Inbox.</a></td>
					<td class="yellow-right"><a class="close-yellow"><img src="../../Images/AdminImages/table/icon_close_yellow.gif"   alt="" /></a></td>
				</tr>
				</table>
				</div>
				<!--  end message-yellow -->
				
				<!--  start message-red -->
				<div id="message-red">
				<table border="0" width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td class="red-left">Error. <a href="">Please try again.</a></td>
					<td class="red-right"><a class="close-red"><img src="../../Images/AdminImages/table/icon_close_red.gif"   alt="" /></a></td>
				</tr>
				</table>
				</div>
				<!--  end message-red -->
				
				<!--  start message-blue -->
				<div id="message-blue">
				<table border="0" width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td class="blue-left">Welcome back. <a href="">View my account.</a> </td>
					<td class="blue-right"><a class="close-blue"><img src="../../Images/AdminImages/table/icon_close_blue.gif"   alt="" /></a></td>
				</tr>
				</table>
				</div>
				<!--  end message-blue -->
			
				<!--  start message-green -->
				<div id="message-green">
				<table border="0" width="100%" cellpadding="0" cellspacing="0">
				<tr>
					<td class="green-left">Product added sucessfully. <a href="">Add new one.</a></td>
					<td class="green-right"><a class="close-green"><img src="../../Images/AdminImages/table/icon_close_green.gif"   alt="" /></a></td>
				</tr>
				</table>
				</div>*@
				<!--  end message-green -->
		            <!--  start step-holder -->
		        <div id="step-holder">
                    <div class="step-no">+</div>
			        <div class="step-dark-left"><a href="/managealbum/viewallalbum?pageindex=1">Xem tất cả</a></div>
			        <div class="step-dark-right">&nbsp;</div>			       
			        <div class="step-no-off">+</div>
			        <div class="step-light-left"><a href="/managealbum/uploadalbumpage">Upload album mới</a></div>
			        <div class="step-light-right">&nbsp;</div>			
			        <div class="clear"></div>
		        </div>
		<!--  end step-holder -->
		    
				<!--  start product-table ..................................................................................... -->
				<form id="mainform" action="">
                    <h3>Website hiện đang có <strong>@ViewBag.count</strong> albums.</h3>
				<table border="0" width="100%" cellpadding="0" cellspacing="0" id="product-table">
				<tr>
					<th class="table-header-check"><a id="toggle-all" ></a> </th>
					<th class="table-header-repeat line-left minwidth-1"><a href="">Tên Album</a>	</th>
					<th class="table-header-repeat line-left minwidth-1"><a href="">Thể loại</a></th>
					<th class="table-header-repeat line-left"><a href="">Ca sĩ</a></th>
					<th class="table-header-repeat line-left"><a href="">Năm phát hành</a></th>
					<th class="table-header-repeat line-left"><a href="">Số bài hát</a></th>
					<th class="table-header-options line-left"><a href="">Tuỳ chọn</a></th>
				</tr>
                    @for (int i = 0; i < lst.Count; i++)
                    {
                        if (i % 2 == 0)
                        {                 
                        <tr>
					        <td><input type="checkbox"/></td>
					        <td>@lst[i].AlbumName</td>
					        <td>@lst[i].CategoryName</td>
					        <td><a href="">@lst[i].SingerName</a></td>
					        <td>@lst[i].ReleaseYear</td>
					        <td><a href="">@{ListenMusic.Models.Reposistory.Admin.ManageAlbumReposistory a = new ListenMusic.Models.Reposistory.Admin.ManageAlbumReposistory(); int c = a.countSonginAlbum(@lst[i].AlbumID); }@c</a></td>
					        <td class="options-width">					       
					        <a href="/ManageAlbum/UpdateAlbumPage?albumid=@lst[i].AlbumID" title="Cập nhật" class="icon-1 info-tooltip"></a>		
					        <a href="" title="Xoá" class="icon-2 info-tooltip"></a>		
					        </td>
				        </tr>
                        }
                        else
                        { 
                            <tr class="alternate-row">
					        <td><input type="checkbox"/></td>
					        <td>@lst[i].AlbumName</td>
					        <td>@lst[i].CategoryName</td>
					        <td><a href="">@lst[i].SingerName</a></td>
					        <td>@lst[i].ReleaseYear</td>
					        <td><a href="">@{ListenMusic.Models.Reposistory.Admin.ManageAlbumReposistory a = new ListenMusic.Models.Reposistory.Admin.ManageAlbumReposistory(); int c = a.countSonginAlbum(@lst[i].AlbumID); }@c</a></td>
					        <td class="options-width">					       
                            <a href="/ManageAlbum/UpdateAlbumPage?albumid=@lst[i].AlbumID" title="Cập nhật" class="icon-1 info-tooltip"></a>		
					        <a href="" title="Xoá" class="icon-2 info-tooltip"></a>		
                            @*<a href="" title="Edit" class="icon-3 info-tooltip"></a>	
                             <a href="" title="Edit" class="icon-4 info-tooltip"></a>				       
					        <a href="#" title="Active" class="icon-5 info-tooltip"></a>     *@
					        </td>
				        </tr>
                        }
                    }
				</table>
				<!--  end product-table................................... --> 
				</form>
			</div>
			<!--  end content-table  -->
		
			<!--  start actions-box ............................................... -->
			<div id="actions-box">
				<a href="" class="action-slider"></a>
				<div id="actions-box-slider">
					<a href="" class="action-edit">Edit</a>
					<a href="" class="action-delete">Delete</a>
				</div>
				<div class="clear"></div>
			</div>
			<!-- end actions-box........... -->
			
			<!--  start paging..................................................... -->
			<table border="0" cellpadding="0" cellspacing="0" id="paging-table">
			<tr>
			<td>
				 @{
                    ViewBag.next =  ViewBag.pageindex + 1;
                    if(ViewBag.pageindex >= ViewBag.totalSong)
                    {
                        ViewBag.next = ViewBag.totalSong;
                    }
                    ViewBag.pre = ViewBag.pageindex - 1;
                    }
				<a href="/managealbum/ViewAllAlbum?pageindex=1" title="Về trang đầu" class="page-far-left"></a>
				<a href="/managealbum/ViewAllAlbum?pageindex=@ViewBag.pre" title="Trang trước" class="page-left"></a>
				<div id="page-info">Trang <strong>@ViewBag.pageindex</strong> / @ViewBag.totalAlbum</div>
				<a href="/managealbum/ViewAllAlbum?pageindex=@ViewBag.next" title="Trang kế" class="page-right"></a>
				<a href="/managealbum/ViewAllAlbum?pageindex=@ViewBag.totalAlbum" title="Đến trang cuối" class="page-far-right"></a>
			</td>
			<td>			
                <input type="text" style="width:30px" name="fastgo" id="fastgo" /> <a href="javascript:fastGo()" class="button-fast-go" id="btngo" name="btngo">&nbsp Đi &nbsp</a>
			</td>
			</tr>
			</table>
			<!--  end paging................ -->
			<div class="clear"></div>
		 
		</div>
		<!--  end content-table-inner ............................................END  -->
		</td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
	<div class="clear">&nbsp;</div>
<div class="clear">&nbsp;</div>

